package memberrewards.listeners;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import memberrewards.helpers.SeedDataPopulator;

public class ApplicationListener implements ServletContextListener{
	private ServletContext servletContext=null;
	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		servletContext=null;	
	}

	@Override
	public void contextInitialized(ServletContextEvent sce) {
		this.servletContext=sce.getServletContext();
		if(servletContext.getInitParameter("populateSeedData")!=null && "true".equalsIgnoreCase(
				servletContext.getInitParameter("populateSeedData")
				)){
			SeedDataPopulator.pouplateSeedData();
		}
	}

}
